package com.example.hr.text_android.uitis;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

/**
 * Created by hr on 2017/8/3.
 */
public class AppUtils {

    /**
     * 图片屏幕适配
     */
    public static void setImageMatch(Activity context, View imageView) {
        WindowManager wm1 = context.getWindowManager();
        int managerWidth = wm1.getDefaultDisplay().getWidth();//获取屏幕宽度
        ViewGroup.LayoutParams para;
        para = imageView.getLayoutParams();
        para.width = (int) (managerWidth * 0.33);//设置View宽度
        para.height = (int) (managerWidth * 0.33);//设置View高度
        imageView.setLayoutParams(para);
    }

}
